<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Login page</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="/main.css"/>
    <script th:src="@{/main.js}"></script>
</head>
<body>
<aside id="explanation" class="explain hide">
    <div class="container">
        <header class="title">
            <h2>SAML 属性操作</h2>
            <a href="/close" id="close" class="close"><span class="sr-only">Close </span>&#9747;</a>
        </header>
        <div class="explanation-content">
            <p>
                当Mujina IDP将SAML断言发送回服务提供者时，所有属性都将作为SAML AttributeStatement元素添加
            </p>
            <p>
                根据服务提供者的属性释放策略，它们将包含在经过身份验证的用户标识中。
            </p>
            <p>
                如果要为一个属性添加多个值(例如isMemberOf)，则需要多次添加它们。
            </p>

            <hr/>

            <p>
                如果您添加属性并选中“Persist me”框，则属性将保存在您输入的“Username”下。
            </p>
            <p>
                在使用相同的用户名进行后续登录时，将向服务提供者发送相同的属性集。
            </p>
        </div>
    </div>
</aside>

<main class="login-container">
    <div class="login">
        <h1>Mujina 身份提供者 登录页</h1>
        <p th:if="${param.error}" class="error">Wrong user or password</p>
        <form class="login-form" th:action="@{/login}" method="post">
            <label for="username" class="sr-only">Username</label>
            <input type="text" id="username" name="username" autofocus="autofocus" placeholder="Username"/>
            <label for="password" class="sr-only">Password</label>
            <input type="password" id="password" name="password" placeholder="Password"/>
            <input class="button" type="submit" value="Log in"/>
            <div>
                <input id="persist-me" name="persist-me" type="checkbox"/>
                <label class="persist-me" for="persist-me">记住我</label>
            </div>

            <div class="add-attribute">
                <label for="add-attribute" class="sr-only">Select attributes</label>
                <select class="attribute-select" id="add-attribute">
                    <option value="Add attribute...">添加属性...</option>
                    <option th:each="attr : ${samlAttributes}" th:value="${attr.get('name')}"
                            th:text="${attr.get('id')}"
                            th:attr="data-multiplicity=${attr.get('multiplicity')}"></option>
                </select>
                <div class="help"><span class="explain-link">?</span></div>
            </div>
            <ul id="attribute-list" class="attribute-list"></ul>
            <section class="powered-by">
                <a href="https://openconext.org/" target="_blank" rel="noreferrer noopener">Copyright © 2018 OpenConext</a>
            </section>
        </form>
    </div>
</main>
</body>
</html>
